package com.example.blogsystem.service;

import com.example.blogsystem.mapper.BlogInfoMapper;
import com.example.blogsystem.model.BlogInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BlogInfoService {

    @Autowired
    private BlogInfoMapper blogInfoMapper;
    public List<BlogInfo> getBlogList() {
        return blogInfoMapper.selectAllBlog();
    }

    public BlogInfo getBlog(Integer id) {
        return blogInfoMapper.queryById(id);
    }

    public Integer addBlogInfo(BlogInfo blogInfo) {
       return blogInfoMapper.addBlog(blogInfo);
    }

    public Integer delete(Integer blogId) {
       return blogInfoMapper.deleteById(blogId);
    }

    public Integer update(BlogInfo blogInfo) {
        return blogInfoMapper.updateById(blogInfo);
    }

    public Integer countBlogInfo() {
        return blogInfoMapper.countBlog();
    }
}
